home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_28465.txt < prev    next >
Text File  |  1991-02-27  |  2KB  |  37 lines

  1. -- card: 28465 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. the program's execution, and is deallocated upon the program's termination.  As
  11. mentioned earlier, this variable may be accessed from within other source files provided these source files redeclare the variable.  Since space for the variable must be allocated only once, the declaration in one and only one of the source files should also serve as a definition for the variable.  This is accomplished in one of two ways in ANSI C.  (1)  The (sole) definition is of the form 'int  id_number' and the declarations in other files are of the form 'extern int  id_number'.  (2)  The (sole) definition involves an initialization as 'extern int  id_number = 0' and the declarations in other files are of the form 'extern int  id_number'.  Only (1) is supported by Think C v. 4.0.
  12.  
  13. Although function definitions do not allocate space as variable definitions do, a distinction is still made between the function definition and a declaration of this entity.  Functions are defined in a single source file, and the function "prototype" is used to declare the function for access in other source files*.
  14.  
  15. Since the "definition" of a user-defined data type includes declarations needed by the compiler, it must be included in every source file using the data type.  As mentioned earlier, header files are usually used to avoid repetition**.
  16.  
  17. -- part contents for background part 7
  18. ----- text -----
  19. 78
  20.  
  21. -- part contents for background part 29
  22. ----- text -----
  23. 31005
  24. 52189
  25.  
  26. -- part contents for background part 27
  27. ----- text -----
  28. Function scopes
  29. File inclusion
  30.  
  31. -- part contents for background part 20
  32. ----- text -----
  33. Function scopes - p93
  34.  
  35. -- part contents for background part 23
  36. ----- text -----
  37. File inclusion - p175